package com.wk.kxexamadminister.controller;

import com.wk.kxexamadminister.entity.Judgment;
import com.wk.kxexamadminister.mapper.JudgmentMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.chrono.JapaneseDate;
import java.util.List;

@Controller
public class JudgmentController {

    @Autowired
    private JudgmentMapper judgmentMapper;

    @ApiOperation("增加")
    @PostMapping("/addJudgment")
    @ResponseBody
    public String addJudgment(Judgment judgment){
        int insert = judgmentMapper.insert(judgment);
        if(insert == 1) {
            return "Success";
        }
        return "No";
    }

    @ApiOperation("/查看全部")
    @PostMapping("/findAllJudgment")
    public String findAllJudgment(Model model){
        List<Judgment> judgments = judgmentMapper.selectList(null);
        model.addAttribute("allJudgments",judgments);
        return "";
    }






}
